package date1128.create;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.lu.jdog.util.Resource;

//<!-- 组合属性注入 -->
public class SpringTest {
	private static ApplicationContext applicationContext;
	public static void main(String[] args) {
		applicationContext = new ClassPathXmlApplicationContext(Resource.getAssertPath(SpringTest.class,"beans.xml"));
		

//		Apple apple = applicationContext.getBean("fruitFactory",Apple.class);
//		System.out.println(apple.getName());

//		getBean获取的是Fruit的实例，而不是工厂类的实例。此时调用的是静态工厂
		Object obj = applicationContext.getBean("greenApple");
		System.out.println(obj);
		
//		此时调用的是实例工厂
		Object obj2 = applicationContext.getBean("yellowApple");
		System.out.println(obj2);
		
		
	}
}
